import { Pipe, PipeTransform } from '@angular/core';
import {DatePipe} from "@angular/common";

@Pipe({
  name: 'duedate'
})
export class DuedatePipe implements PipeTransform {

  result='';
  constructor(private datePipe: DatePipe) {
  }

  transform(value: number, ...args: unknown[]): unknown {
    if(value==-1){
      this.result='长期'
    }
    else {
      this.result=this.datePipe.transform(value,'yyyy-MM-dd')!;
    }

    return this.result;
  }

}
